
#ifndef PROGRESSMANAGER_H
#define PROGRESSMANAGER_H

#include "Singleton.h"
#include "SB.h"
#include "AchievementData.h"
//#include "UpgradeData.h"
//#include "PowerupData.h"
#include "SaveGame.h"
#include "defs.h"
#include <map>

class ProgressManager : public Singleton<ProgressManager>
{
private:
    AchievementData m_aAchievements[MAX_ACHIEVEMENTS];
//    UpgradeData m_aUpgrades[UPGRADES_COUNT];
//    PowerupData m_aPowerups[POWERUPS_ITEMS_COUNT];
    
	SaveGame m_sSaveGame;
	
public:
	ProgressManager();
	~ProgressManager();
	
public:
    void loadAchievements();
    void loadUpgrades();
    void loadPowerups();
    
    void load();
    void save();
    void updateAchievements();
	
	void gameCompleted(int _iBabies, int _iCoins, int _iPrizes, int _iChainMax);
	
	//getters
    bool isMusicOn(){return m_sSaveGame.bMusic;};

	int getBabiesFedMax(){return m_sSaveGame.iBabiesFedMax;};
    int getBabiesFedTotal(){return m_sSaveGame.iBabiesFedTotal;};
    int getCoins(){return m_sSaveGame.iCoins;};
    int getCoinsTotal(){return m_sSaveGame.iCoinsTotal;};
    int getCoinsSpent(){return m_sSaveGame.iCoinsSpent;};
    int getGamesTotal(){return m_sSaveGame.iGamesTotal;};
    int getPrizesTotal(){return m_sSaveGame.iPrizesTotal;};
    int getChainMax(){return m_sSaveGame.iChainMax;};
    
    bool isAchievementDone(int _iIndex){return m_sSaveGame.sAchievementData[_iIndex].bUnlocked;}
    std::string getAchievementName(int _iIndex){ return m_aAchievements[_iIndex].sName;}
    std::string getAchievementDesc(int _iIndex);
    std::string getAchievementPacifier(int _iIndex){ return m_aAchievements[_iIndex].sPacifier;}
    int getAchievementPoints(int _iIndex){ return m_aAchievements[_iIndex].iGamerpoints;}
    
    SaveGame getSavedData(){ return m_sSaveGame; }
    //void substractPowerUp(int _iPowerUp);
    
/*
    AchievementData getAchievementData(int _iIndex){ return m_aAchievements[_iIndex]; }
    UpgradeData getUpgradeData(int _iIndex){ return m_aUpgrades[_iIndex]; }
    PowerupData getPowerupData(int _iIndex){ return m_aPowerups[_iIndex]; }

    ePowerupType getPowerupType(std::string _sType);
    eUpgradeType getUpgradeType(std::string _sType);
*/
    
    //setters
	void setBabiesFedMax(int _iBabiesFedMax){ m_sSaveGame.iBabiesFedMax = _iBabiesFedMax;};
    void setBabiesFedTotal(int _iBabiesFedTotal){ m_sSaveGame.iBabiesFedTotal = _iBabiesFedTotal;};
    void setCoins(int _iCoins){ m_sSaveGame.iCoins = _iCoins;};
    void setCoinsTotal(int _iCoinsTotal){ m_sSaveGame.iCoinsTotal = _iCoinsTotal;};
    void setCoinsSpent(int _iCoinsSpent){ m_sSaveGame.iCoinsSpent = _iCoinsSpent;};
    void setGamesTotal(int _iGamesTotal){ m_sSaveGame.iGamesTotal = _iGamesTotal;};
    void setPrizesTotal(int _iPrizesTotal){ m_sSaveGame.iPrizesTotal = _iPrizesTotal;};
    void setChainMax(int _iChainMax){ m_sSaveGame.iChainMax = _iChainMax;};
    
    void setSavedData(SaveGame _sSaveGame){ m_sSaveGame = _sSaveGame; }

//    void switchBabyUsed(int _iBaby){ m_sSaveGame.sBabyData[_iBaby].bActive = !m_sSaveGame.sBabyData[_iBaby].bActive; }
    
};

#endif
